package com.apollow.oschina.base;

import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * Created by Dragon on 2017/1/12.
 */

public abstract class BaseHolder<T> extends RecyclerView.ViewHolder{
    private View mView;
    private T data;

   public BaseHolder(View itemView) {
        super(itemView);
        mView = initView(itemView);
        mView.setTag(this);
    }

     public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
        bindData(data);
    }

    protected abstract void bindData(T data);

    public abstract View initView(View parent);

    public View getRootView(){
        return mView;
    }
}
